feat(codegen): generate wasm bridge callbacks#265
Open
pgherveou wants to merge 76 commits into
Open
Conversation
Adds the canonical testing module (api/testing.rs) and its v01/v02/versioned wiring used by the Rust host runtime and generated clients.
New crate defining the host syscall traits (storage, navigation, consent, permissions, ...) that host runtimes implement. Types are re-exported from truapi::versioned/v01 rather than redefined.
…backs Extends the rustdoc-JSON code generator to emit the Rust dispatcher and wire table consumed by truapi-server, plus the TS host-callbacks adapter. Golden tests pin the emitted shapes.
…o rust-core/04-wasm-bridge-codegen # Conflicts: # rust/crates/truapi-codegen/tests/golden_rust_emit.rs # rust/crates/truapi-server/src/wasm.rs
…dge-codegen # Conflicts: # rust/crates/truapi-codegen/tests/golden/host-callbacks-adapter.ts # rust/crates/truapi-codegen/tests/golden/host-callbacks.ts
…dge-codegen # Conflicts: # rust/crates/truapi-codegen/tests/golden/host-callbacks-adapter.ts # rust/crates/truapi-codegen/tests/golden/host-callbacks.ts # rust/crates/truapi-codegen/tests/golden/worker-callbacks.ts # rust/crates/truapi-codegen/tests/golden_rust_emit.rs # rust/crates/truapi-server/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the generated Rust wasm-bindgen platform bridge and derives host callback namespace/adapter names from
truapi-platformtrait metadata.The codegen pipeline no longer hardcodes the current platform trait set. Adding a new platform trait should only require providing the corresponding JS namespace/adapter implementation, not changing the Rust/TS codegen selection logic.
This layer also updates generated goldens for namespaced
HostCallbacks,FlatHostCallbackscompatibility,RequiredHostCallbacks, and encoded platform-local bridge payloads.Stack
Part of the Rust core runtime port umbrella #104. Full port sequence:
truapitesting API and versioned wiring.truapi-platformhost capability traits.@parity/truapi-host-wasmnamespaced callback consumer.Active child #253 is kept tree-equivalent with umbrella #104.
Validation
cargo fmt --all --checkcargo check -p truapi-codegencargo check -p truapi-servercargo test -p truapi-codegen golden_TRUAPI_SKIP_PACKAGE_BUILD=1 ./scripts/codegen.sh